BX.namespace("BX.Main");if(typeof BX.Main.interfaceButtons==="undefined"){BX.Main.interfaceButtons=function(t,e){this.classItem="main-buttons-item";this.classItemSublink="main-buttons-item-sublink";this.classItemText="main-buttons-item-text";this.classItemCounter="main-buttons-item-counter";this.classItemIcon="main-buttons-item-icon";this.classItemMore="main-buttons-item-more";this.classOnDrag="main-buttons-drag";this.classDropzone="main-buttons-submenu-dropzone";this.classSeparator="main-buttons-submenu-delimiter";this.classHiddenLabel="main-buttons-hidden-label";this.classSubmenuItem="main-buttons-submenu-item";this.classItemDisabled="main-buttons-disabled";this.classItemOver="--over";this.classMenuShown="--menu-shown";this.classItemActive="main-buttons-item-active";this.classSubmenu="main-buttons-submenu";this.classSecret="secret";this.classItemLocked="--locked";this.classExtraItemLink="";this.classExtraItemText="";this.classExtraItemIcon="";this.classExtraItemCounter="";this.submenuIdPrefix="main_buttons_popup_";this.childMenuIdPrefix="main_buttons_popup_child_";this.submenuWindowIdPrefix="menu-popup-";this.classSettingMenuItem="main-buttons-submenu-setting";this.classEditState="main-buttons-edit";this.classEditItemButton="main-buttons-item-edit-button";this.classDragItemButton="main-buttons-item-drag-button";this.classSettingsApplyButton="main-buttons-submenu-settings-apply";this.classSettingsResetButton="main-buttons-submenu-settings-reset";this.classSetHome="main-buttons-set-home";this.classSetHide="main-buttons-set-hide";this.classManage="main-buttons-manage";this.classContainer="main-buttons";this.classSubmenuNoHiddenItem="main-buttons-submenu-item-no-hidden";this.classDefaultSubmenuItem="menu-popup-item";this.classDefaultSubmenuDelimimeter="popup-window-delimiter-section";this.classInner="main-buttons-inner-container";this.listContainer=null;this.dragItem=null;this.overItem=null;this.moreButton=null;this.messages=null;this.licenseParams=null;this.ajaxSettings=null;this.enableItemMouseEnter=true;this.menuShowTimeout=null;this.isMoreMenuShown=false;this.onDragStarted=false;this.isSettingsEnabled=true;this.containerId=e.containerId;this.isEditEnabledState=false;this.theme=BX.Type.isStringFilled(e.theme)?e.theme:"default";this.maxItemLength=BX.Type.isNumber(e.maxItemLength)&&e.maxItemLength>6?e.maxItemLength:20;this.tmp={};this.itemData=new WeakMap;this.handleMoreMenuItemMouseEnter=this.handleMoreMenuItemMouseEnter.bind(this);this.init(t,e);return{getItemById:this.getItemById.bind(this),getAllItems:this.getAllItems.bind(this),getHiddenItems:this.getHiddenItems.bind(this),getVisibleItems:this.getVisibleItems.bind(this),getDisabledItems:this.getDisabledItems.bind(this),getMoreButton:this.getMoreButton.bind(this),adjustMoreButtonPosition:this.adjustMoreButtonPosition.bind(this),getItemData:this.getItemData.bind(this),getSubmenu:this.getMoreMenu.bind(this),showSubmenu:this.showMoreMenu.bind(this),closeSubmenu:this.closeMoreMenu.bind(this),refreshSubmenu:this.refreshMoreMenu.bind(this),getMoreMenu:this.getMoreMenu.bind(this),showMoreMenu:this.showMoreMenu.bind(this),closeMoreMenu:this.closeMoreMenu.bind(this),refreshMoreMenu:this.refreshMoreMenu.bind(this),getCurrentSettings:this.getCurrentSettings.bind(this),saveSettings:this.saveSettings.bind(this),updateCounter:this.updateCounter.bind(this),getActive:this.getActive.bind(this),isDisabled:this.isDisabled.bind(this),isVisibleItem:this.isVisibleItem.bind(this),isEditEnabled:this.isEditEnabled.bind(this),isActiveInMoreMenu:this.isActiveInMoreMenu.bind(this),isSettingsEnabled:this.isSettingsEnabled,classes:{item:this.classItem,itemText:this.classItemText,itemCounter:this.classItemCounter,itemIcon:this.classItemIcon,itemDisabled:this.classItemDisabled,itemOver:this.classItemOver,itemActive:this.classItemActive,itemLocked:this.classItemLocked,menuShown:this.classMenuShown,submenu:this.classSubmenu,submenuItem:this.classSubmenuItem,containerOnDrag:this.classOnDrag,classSettingMenuItem:this.classSettingMenuItem},itemsContainer:this.listContainer,itemsContainerId:this.listContainer.id}};BX.Main.interfaceButtons.prototype={init:function(t,e){this.listContainer=BX(this.getId());if(!BX.Type.isPlainObject(e)){throw"BX.MainButtons: params is not Object"}if(!("containerId"in e)||!BX.Type.isStringFilled(e.containerId)){throw"BX.MainButtons: containerId not set in params"}if(!BX.Type.isDomNode(this.listContainer)){throw"BX.MainButtons: #"+e.containerId+" is not dom node"}if("classes"in e&&BX.Type.isPlainObject(e.classes)){this.setCustomClasses(e.classes)}if("messages"in e&&BX.Type.isPlainObject(e.messages)){this.setMessages(e.messages)}if("licenseWindow"in e&&BX.Type.isPlainObject(e.licenseWindow)){this.setLicenseWindowParams(e.licenseWindow)}if("disableSettings"in e&&e.disableSettings==="true"){this.isSettingsEnabled=false;this.visibleControlMoreButton()}this.initSaving(e.ajaxSettings);this.moreButton=this.getMoreButton();this.listChildItems={};this.initItems();this.adjustMoreButtonPosition();this.bindEventsOnMoreButton();this.bindOnResizeFrame();BX.Event.bind(this.getContainer(),"click",BX.delegate(this._onDocumentClick,this));BX.addCustomEvent("onPullEvent-main",BX.delegate(this._onPush,this));this.updateMoreButtonCounter();if(this.isActiveInMoreMenu()){this.activateItem(this.moreButton)}const s=this.getHomeItem();if(s){const{url:t}=s;this.lastHomeLink=t}const i=Array.from(this.container.querySelectorAll(".main-buttons-item-child-button"));i.forEach((function(t){const e=t.closest(".main-buttons-item-child");if(e.dataset.isOpened){this.realChildButton=e;const t=e.closest(".main-buttons-item-child-button-cloned");if(t){this.clonedChildButton=t}}BX.Event.bind(t,"click",this.onShowChildButtonClick.bind(this))}),this)},calculateChildListWidth:function(){if(this.realChildButton){const t=this.realChildButton.querySelectorAll(".main-buttons-item-child-list-inner .main-buttons-item");const e=10;return Array.from(t).reduce((function(t,e){const s=BX.Text.toNumber(BX.Dom.style(e,"width"));const i=BX.Text.toNumber(BX.Dom.style(e,"margin-left"));const n=BX.Text.toNumber(BX.Dom.style(e,"margin-right"));return t+s+i+n}),e)}return 0},onShowChildButtonClick:function(t){t.preventDefault();if(!this.realChildButton){this.realChildButton=t.currentTarget.closest(".main-buttons-item-child")}const e=this.realChildButton.querySelector(".main-buttons-item-child-list");this.enableItemMouseEnter=false;setTimeout((()=>{this.enableItemMouseEnter=true}),200);const s=BX.Dom.attr(this.realChildButton,"data-child-items");const i=BX.Dom.attr(this.realChildButton,"data-is-opened");let n={};if(i){BX.Dom.attr(this.realChildButton,"data-is-opened",null);s.forEach((function(t){const e=this.getContainer().querySelector('[data-id="'+t+'"]');BX.Dom.style(e,"display",null);if(t.hasOwnProperty("PARENT_ITEM_ID")){n[t["PARENT_ITEM_ID"]]="N"}}),this);if(this.clonedChildButton){BX.Dom.remove(this.clonedChildButton)}BX.Dom.style(e,{overflow:null,"max-width":null});n=JSON.stringify(n);this.saveOptions("expanded_lists",n)}else{BX.Dom.attr(this.realChildButton,"data-is-opened",true);BX.Dom.style(e,"max-width",this.calculateChildListWidth()+"px");this.cloneChildButton(this.realChildButton);s.forEach((t=>{const e=this.getContainer().querySelector('[data-id="'+t+'"]');BX.Dom.insertBefore(e,this.realChildButton);BX.Dom.style(e,"display","inline-block");if(t.hasOwnProperty("PARENT_ITEM_ID")){n[t["PARENT_ITEM_ID"]]="Y"}}));setTimeout((()=>{BX.Dom.style(e,"overflow","unset")}),200);n=JSON.stringify(n);this.saveOptions("expanded_lists",n)}setTimeout((()=>{this._onResizeHandler()}),200)},cloneChildButton:function(t){this.clonedChildButton=BX.Runtime.clone(t);const e=this.clonedChildButton.querySelector(".main-buttons-item-child-list");if(e){BX.Dom.remove(e)}BX.Dom.addClass(this.clonedChildButton,"main-buttons-item-child-button-cloned");BX.Dom.style(this.clonedChildButton,"transition","none");BX.Dom.insertBefore(this.clonedChildButton,t);BX.Event.bind(this.clonedChildButton,"click",this.onShowChildButtonClick.bind(this));setTimeout((()=>{BX.Dom.style(this.clonedChildButton,"transition",null)}),0)},_onDocumentClick:function(t){if(this.isDragButton(t.target)){t.preventDefault();t.stopPropagation()}let e=this.getItem(t);if(BX.Type.isDomNode(e)){if(this.isSettings(e)){this.enableEdit();return false}if(this.isApplySettingsButton(e)){t.preventDefault();t.stopPropagation();this.disableEdit();return false}if(this.isResetSettingsButton(e)){this.resetSettings();return false}if(this.isEditButton(t.target)){this.handleEditButtonClick(t);return false}if(this.isSetHide(e)){const t=this.getVisibleItems();const e=BX.Type.isArray(t)?t.length:null;const s=this.editItemData.ID.replace(this.listContainer.id+"_","");let i=this.getItemById(s);const n=this.getItemAlias(i);i=this.isVisibleItem(i)?i:n;if(this.isDisabled(n)){this.enableItem(n)}else if(!this.isDisabled(n)&&e>2){this.disableItem(n)}if(e===1){BX.onCustomEvent(window,"BX.Main.InterfaceButtons:onHideLastVisibleItem",[i,this])}this.refreshMoreMenu();this.saveSettings();this.adjustMoreButtonPosition();if(this.isEditEnabled()){this.enableEdit()}this.editMenu.popupWindow.close();return false}if(this.isSetHome(e)){const t=this.editItemData.ID.replace(this.listContainer.id+"_","");const e=this.getItemById(t);const s=this.getItemAlias(e);if(this.isDisabled(s)){this.enableItem(s)}this.listContainer.insertBefore(e,BX.firstChild(this.listContainer));this.adjustMoreButtonPosition();this.refreshMoreMenu();this.saveSettings();if(this.isEditEnabled()){this.enableEdit()}this.editMenu.popupWindow.close();return false}if(!this.isDragButton(t.target)&&!this.isEditButton(t.target)){const s=this.getItemData(e);let i=s["ON_CLICK"];if(this.isSublink(t.target)){i=BX.Type.isPlainObject(s["SUB_LINK"])?s["SUB_LINK"]["ON_CLICK"]:""}if(BX.Type.isStringFilled(i)){t.preventDefault();this.execScript(i,t)}}}if(this.isEditEnabled()&&this.getMoreMenu()){this.getMoreMenu().getPopupWindow().setAutoHide(false)}},isActiveInMoreMenu:function(){const t=this.getHiddenItems();const e=this.getDisabledItems();const s=t.concat(e);return s.some((function(t){const e=this.getItemData(t);return e["IS_ACTIVE"]===true}),this)},_onPush:function(t,e){if(t==="user_counter"&&e&&BX.message("SITE_ID")in e){const t=e[BX.message("SITE_ID")];for(const e in t){if(t.hasOwnProperty(e)){this.updateCounter(e,t[e])}}}},getActive:function(){let t=this.getAllItemsData();let e=null;let s=null;while(BX.Type.isArrayFilled(t)){const i=t.shift();if(i["IS_ACTIVE"]===true){if(s===null){s=i}e=i;t=BX.Type.isArrayFilled(i["ITEMS"])?[...i["ITEMS"]]:null}}if(e!==null&&s!==null){const t=BX(s.ID);if(BX.Type.isDomNode(t)){e.NODE=t}else{e.NODE=null}}return e},isSetHome:function(t){return BX.Dom.hasClass(t,this.classSetHome)},isSetHide:function(t){return BX.Dom.hasClass(t,this.classSetHide)},getSettingsButton:function(){return BX.Buttons.Utils.getByClass(this.getMoreMenuContainer(),this.classSettingMenuItem)},getSettingsApplyButton:function(){return BX.Buttons.Utils.getByClass(this.getMoreMenuContainer(),this.classSettingsApplyButton)},isApplySettingsButton:function(t){return BX.Dom.hasClass(t,this.classSettingsApplyButton)},enableEdit:function(){const t=this.getMoreMenu();if(t){const e=t.getPopupWindow();e.setAutoHide(false);BX.Dom.addClass(e.getPopupContainer(),this.classEditState)}BX.Dom.addClass(this.listContainer,this.classEditState);this.isEditEnabledState=true},disableEdit:function(){const t=this.getMoreMenu();if(t){const e=t.getPopupWindow();e.setAutoHide(true);BX.Dom.removeClass(e.getPopupContainer(),this.classEditState)}BX.Dom.removeClass(this.listContainer,this.classEditState);this.isEditEnabledState=false;this.destroyItemEditMenu()},isEditEnabled:function(){return this.isEditEnabledState},showItemEditMenu:function(t,e){if(BX.Type.isPlainObject(t)&&"ID"in t){const s=[this.listContainer.id,"_edit_item"].join("");let i=BX.Main.MenuManager.getMenuById(s);if(i){BX.Main.MenuManager.destroy(s)}i=this.createItemEditMenu(t,s,e);i.popupWindow.show()}},destroyItemEditMenu:function(){const t=[this.listContainer.id,"_edit_item"].join("");const e=BX.Main.MenuManager.getMenuById(t);if(e){BX.Main.MenuManager.destroy(t)}},getContainer:function(){if(!BX.Type.isDomNode(this.container)){this.container=BX(this.containerId).parentNode.parentNode}return this.container},getItemEditMenu:function(){return BX.Main.MenuManager.getMenuById([this.listContainer.id,"_edit_item"].join(""))},createItemEditMenu:function(t,e,s){const i=[{text:this.message("MIB_SET_HOME"),className:"main-buttons-set-home menu-popup-no-icon"}];const n=t["ID"].replace(this.listContainer.id+"_","");const o=this.getItemById(n);if(this.isDisabled(o)){i.push({text:this.message("MIB_SET_SHOW"),className:"main-buttons-set-hide menu-popup-no-icon"})}else{i.push({text:this.message("MIB_SET_HIDE"),className:"main-buttons-set-hide menu-popup-no-icon"})}if(t["IS_PINNED"]){const e=this.getParentItem(t["ID"]);i.push({text:this.message("MIB_UNPIN_ITEM").replace("#NAME#",e?e["TEXT"]:""),onclick:(e,s)=>{this.handleItemUnpin(t,o);s.getMenuWindow().close()}})}const a=BX.pos(s);const u={menuId:e,anchor:s,menuItems:i,settings:{autoHide:true,offsetTop:0,offsetLeft:a.width/2,zIndex:20,angle:{position:"top",offset:a.width/2}}};const r=BX.Main.MenuManager.create(u.menuId,u.anchor,u.menuItems,u.settings);if(this.isVisibleItem(o)){t.NODE=o}else{t.NODE=this.getItemAlias(o)}this.editItemData=t;if("menuItems"in r&&BX.Type.isArray(r.menuItems)){r.menuItems.forEach((function(t){BX.Event.bind(t.layout.item,"click",BX.delegate(this._onDocumentClick,this))}),this)}BX.onCustomEvent(window,"BX.Main.InterfaceButtons:onBeforeCreateEditMenu",[r,t,this]);this.editMenu=r;return r},setHome:function(){const t=this.getHomeItem();if(!t){return}const{itemData:e,url:s,firstVisibleItem:i}=t;if(!e){return}if(this.lastHomeLink!==s){this.saveOptions("firstPageLink",s);BX.onCustomEvent("BX.Main.InterfaceButtons:onFirstItemChange",[s,i])}this.lastHomeLink=s},getHomeItem:function(){const t=this.getVisibleItems();const e=BX.Type.isArray(t)&&t.length>0?t[0]:null;if(!e){return null}const s=this.getItemData(e);const i=this.normalizeUrl(s["URL"]);if(this.canBeHomed(i,s)){return{itemData:s,url:i,firstVisibleItem:e}}if(BX.Type.isArrayFilled(s["ITEMS"])){for(let t=0;t<s["ITEMS"].length;t++){const i=s["ITEMS"][t];if(i["IS_PINNED"]||i["IS_DISBANDED"]||i["IS_DELIMITER"]){continue}const n=this.normalizeUrl(i["URL"]);if(this.canBeHomed(n,i)){return{itemData:i,url:n,firstVisibleItem:e}}}}return null},normalizeUrl:function(t){if(!BX.Type.isStringFilled(t)){return""}if(t.charAt(0)==="?"){const e=document.createElement("a");e.href=t;t=e.pathname+e.search}return t},canBeHomed:function(t,e){if(!BX.Type.isStringFilled(t)||BX.Type.isStringFilled(e["ON_CLICK"])){return false}if(BX.Reflection.getClass("BX.SidePanel.Instance")){const e=BX.SidePanel.Instance.getUrlRule(t);if(e){return false}}const s=new BX.Event.BaseEvent({data:{itemLink:t,itemData:e}});BX.Event.EventEmitter.emit("BX.Main.InterfaceButtons:onBeforeFirstItemChange",s);return!s.isDefaultPrevented()},isEditButton:function(t){return BX.Dom.hasClass(t,this.classEditItemButton)},isDragButton:function(t){return BX.Dom.hasClass(t,this.classDragItemButton)},isResetSettingsButton:function(t){return BX.Dom.hasClass(t,this.classSettingsResetButton)},getContainerHeight:function(){const t=this.getAllItems().map((function(t){const e=getComputedStyle(t);return BX.height(t)+parseInt(e.marginTop)+parseInt(e.marginBottom)}));return Math.max.apply(Math,t)},setLicenseWindowParams:function(t){this.licenseParams=t||{}},message:function(t){let e;try{e=this.messages[t]}catch(t){e=""}return e},setCustomClasses:function(t){if(!BX.Type.isPlainObject(t)){return}this.classItem=t.item||this.classItem;this.classItemSublink=t.itemSublink||this.classItemSublink;this.classItemText=t.itemText||this.classItemText;this.classItemCounter=t.itemCounter||this.classItemCounter;this.classItemIcon=t.itemIcon||this.classItemIcon;this.classItemMore=t.itemMore||this.classItemMore;this.classItemOver=t.itemOver||this.classItemOver;this.classMenuShown=t.menuShown||this.classMenuShown;this.classItemActive=t.itemActive||this.classItemActive;this.classItemDisabled=t.itemDisabled||this.classItemDisabled;this.classOnDrag=t.onDrag||this.classOnDrag;this.classDropzone=t.dropzone||this.classDropzone;this.classSeparator=t.separator||this.classSeparator;this.classSubmenuItem=t.submenuItem||this.classSubmenuItem;this.classSubmenu=t.submenu||this.classSubmenu;this.classSecret=t.secret||this.classSecret;this.classItemLocked=t.itemLocked||this.classItemLocked;this.classExtraItemLink=t.extraItemLink||this.classExtraItemLink;this.classExtraItemText=t.extraItemText||this.classExtraItemText;this.classExtraItemIcon=t.extraItemIcon||this.classExtraItemIcon;this.classExtraItemCounter=t.extraItemCounter||this.classExtraItemCounter},setMessages:function(t){if(!BX.Type.isPlainObject(t)){return}this.messages=t},makeFullItemId:function(t){if(!BX.Type.isStringFilled(t)){return}return[this.listContainer.id,t.replace("-","_")].join("_")},getItemById:function(t){let e=null;if(BX.Type.isStringFilled(t)){const s=t.startsWith(this.listContainer.id)?t:this.makeFullItemId(t);e=BX.Buttons.Utils.getBySelector(this.listContainer,"#"+s.replaceAll(":","\\:"))}return e},getItemCounterObject:function(t){let e=null;if(BX.Type.isDomNode(t)){e=BX.Buttons.Utils.getByClass(t,this.classItemCounter)}return e},updateCounter:function(t,e){if(t.indexOf("crm")===0&&e<0){return}this.updateItemsByCounterId(this.getAllItemsData(),t,e);this.updateMoreButtonCounter()},updateItemsByCounterId:function(t,e,s,i=[]){for(let n=0;n<t.length;n++){const o=t[n];if(o["COUNTER_ID"]===e){o["COUNTER"]=Number(s);this.setCounterValueById(e,o["COUNTER"]);for(let t=i.length-1;t>=0;t--){const e=i[t];e["COUNTER"]=e["ITEMS"].reduce(((t,e)=>{const s=e["IS_PINNED"]===true;const i=BX.Type.isNumber(e["COUNTER"])&&!s?e["COUNTER"]:0;return t+i}),0);this.setCounterValueById(e["COUNTER_ID"],e["COUNTER"])}}if(o["ITEMS"]){this.updateItemsByCounterId(o["ITEMS"],e,s,[...i,o])}}},recalculateItemsCounters:function(t,e=[]){let s=0;for(let i=0;i<t.length;i++){const n=t[i];if(n["ITEMS"]){n["COUNTER"]=this.recalculateItemsCounters(n["ITEMS"],[...e,n])}const o=n["IS_PINNED"]===true;s+=BX.Type.isNumber(n["COUNTER"])&&!o?n["COUNTER"]:0}for(let t=e.length-1;t>=0;t--){const s=e[t];s["COUNTER"]=s["ITEMS"].reduce(((t,e)=>{const s=e["IS_PINNED"]===true;const i=BX.Type.isNumber(e["COUNTER"])&&!s?e["COUNTER"]:0;return t+i}),0);this.setCounterValueById(s["COUNTER_ID"],s["COUNTER"])}return s},setCounterValueById:function(t,e){if(!BX.Type.isStringFilled(t)){return}const s=e>99?"99+":e>0?e:"";const i=document.querySelectorAll(`[data-mib-counter-id="${t}"]`);Array.from(i).forEach((t=>{t.textContent=s}))},setMoreButtonCounter:function(t){const e=this.getItemCounterObject(this.moreButton);e.textContent=t>99?"99+":t>0?t:""},bindEventsOnMoreButton:function(){BX.Event.bind(this.moreButton,"click",this.handleMoreButtonClick.bind(this));BX.Event.bind(this.moreButton,"mouseenter",this.handleMoreButtonMouseEnter.bind(this));BX.Event.bind(this.moreButton,"mouseleave",this.handleMoreButtonMouseLeave.bind(this))},bindOnResizeFrame:function(){window.frames["maininterfacebuttonstmpframe-"+this.getId()].onresize=BX.throttle(this._onResizeHandler,20,this)},getId:function(){return BX.Buttons.Utils.getByClass(this.getContainer(),this.classInner).id},getAllItems:function(){return BX.Buttons.Utils.getByClass(this.listContainer,this.classItem,true)},getAllItemsData:function(){return this.getAllItems().map((t=>this.getItemData(t)))},getVisibleItems:function(){const t=this.getAllItems();let e=[];if(t&&t.length){e=t.filter((t=>this.isVisibleItem(t)&&!this.isDisabled(t)))}return e},getHiddenItems:function(){const t=this.getAllItems();let e=[];if(t&&t.length){e=t.filter((t=>!this.isVisibleItem(t)&&!this.isDisabled(t)))}return e},getDisabledItems:function(){return this.getAllItems().filter((t=>this.isDisabled(t)))},getMoreButton:function(){const t=this.getContainer().getElementsByClassName(this.classItemMore);return t[0]||null},getLastVisibleItem:function(){const t=this.getVisibleItems();let e=null;if(BX.Type.isArray(t)&&t.length){e=t[t.length-1]}if(!BX.Type.isDomNode(e)){e=null}return e},getLastDisabledItem:function(){const t=this.getDisabledItems();let e=null;if(BX.Type.isArray(t)&&t.length){e=t[t.length-1]}if(!BX.Type.isDomNode(e)){e=null}return e},adjustMoreButtonPosition:function(){this.updateMoreButtonCounter();if(this.getMoreMenu()){this.getMoreMenu().getPopupWindow().adjustPosition()}},getMoreMenuId:function(t){let e="";if(BX.Type.isDomNode(this.listContainer)&&BX.Type.isStringFilled(this.listContainer.id)){e=this.submenuIdPrefix+this.listContainer.id}if(t){e=this.submenuWindowIdPrefix+e}return e},getChildMenuId:function(){let t="";if(BX.Type.isDomNode(this.listContainer)&&BX.Type.isStringFilled(this.listContainer.id)){t=this.childMenuIdPrefix+this.listContainer.id}return t},getMenuItemText:function(t,e=null){const s=BX.Type.isElementNode(t)?this.getItemData(t):t;return BX.Tag.render`
				<span class="main-buttons-menu-popup-item">${[BX.Tag.render`<span class="${this.classItemIcon}"></span>`,this.createItemText(s),this.createItemCounter(s),e&&this.isEditEnabled()?this.createItemPin(s,e):""]}</span>
			`},createRootItem:function(t){let e=this.classItem;e+=BX.Type.isStringFilled(t["CLASS"])?" "+t["CLASS"]:"";if(t["IS_PASSIVE"]){e+=" --passive"}else if(t["IS_ACTIVE"]){if(BX.Type.isStringFilled(this.classItemActive)){e+=" "+this.classItemActive}else{e+=" main-buttons-item-active"}}if(t["HAS_MENU"]){e+=" --has-menu"}if(t["IS_LOCKED"]){e+=" --locked"}const s=BX.Tag.render`
				<div
					id="${t["ID"]}"
					class="${e}"
					data-disabled="${t["IS_DISABLED"]}"
					data-class="${t["CLASS_SUBMENU_ITEM"]}"
					data-id="${t["DATA_ID"]}"
					data-top-menu-id="${this.getId()}"
					title=""
				>${[this.createItemLink(t,true),BX.Type.isPlainObject(t["SUB_LINK"])?this.createItemSubLink(t["SUB_LINK"]):""]}</div>
			`;this.setItemData(s,t);return s},createItemLink:function(t,e=false){t=BX.Type.isPlainObject(t)?t:{};let s;const i=["main-buttons-item-link",this.classExtraItemLink].join(" ").trim();if(BX.Type.isStringFilled(t["URL"])){s=BX.Tag.render`<a class="${i}" href="${BX.Text.encode(t["URL"])}"></a>`}else{s=BX.Tag.render`<span class="${i}"></span>`}BX.Dom.append(this.createItemIcon(t),s);BX.Dom.append(this.createItemText(t,e),s);BX.Dom.append(this.createItemCounter(t),s);return s},createItemSubLink:function(t){t=BX.Type.isPlainObject(t)?t:{};const e=BX.Type.isStringFilled(t["CLASS"])?" "+t["CLASS"]:"";const s=BX.Type.isStringFilled(t["URL"])?BX.Text.encode(t["URL"]):"";return BX.Tag.render`
				<a class="${this.classItemSublink}${e}" href="${s}"></a>
			`},createItemIcon:function(t){const e=[this.classItemIcon,this.classExtraItemIcon].join(" ").trim();return BX.Tag.render`<span class="${e}"></span>`},createItemText:function(t,e=false){t=BX.Type.isPlainObject(t)?t:{};const s=[this.classItemText,this.classExtraItemText].join(" ").trim();let i=BX.Type.isStringFilled(t["TEXT"])?t["TEXT"]:"";if(e&&i.length>this.maxItemLength){i=i.substring(0,this.maxItemLength-3)+"..."}let n="";if(BX.Type.isPlainObject(t["SUPER_TITLE"])){let{TEXT:e,CLASS:s,COLOR:i}=t["SUPER_TITLE"];s=BX.Type.isStringFilled(s)?` ${s}`:"";const o=BX.Type.isStringFilled(i)?` style="color:${i}"`:"";n=BX.Tag.render`
					<span class="main-buttons-item-super-title${s}"${o}>${e}</span>
				`}return BX.Tag.render`
				<span class="${s}">${[BX.Tag.render`<span 
						class="main-buttons-item-drag-button"
						onclick="${this.handleDragButtonClick.bind(this)}" 
						data-slider-ignore-autobinding="true"
					></span>`,n,BX.Tag.render`
						<span class="main-buttons-item-text-title">
							<span class="main-buttons-item-text-box">${BX.Text.encode(i)}<span class="main-buttons-item-menu-arrow"></span></span>
						</span>
					`,BX.Tag.render`<span 
						class="main-buttons-item-edit-button"
						onclick="${this.handleEditButtonClick.bind(this)}" 
						data-slider-ignore-autobinding="true"
					></span>`,BX.Tag.render`<span class="main-buttons-item-text-marker"></span>`]}</span>
			`},createItemCounter:function(t){t=BX.Type.isPlainObject(t)?t:{};const e=[this.classItemCounter,this.classExtraItemCounter].join(" ").trim();let s="";const i=BX.Type.isNumber(t["MAX_COUNTER_SIZE"])?t["MAX_COUNTER_SIZE"]:99;if(BX.Type.isNumber(t["COUNTER"])&&t["COUNTER"]>0){s=t["COUNTER"]>i?`${i}+`:t["COUNTER"]}const n=BX.Type.isStringFilled(t["COUNTER_ID"])?t["COUNTER_ID"]:"";return BX.Tag.render`<span data-mib-counter-id="${n}" class="${e}">${s}</span>`},createItemPin:function(t,e){return BX.Tag.render`
				<span class="main-buttons-item-pin" 
					data-slider-ignore-autobinding="true"
					onclick="${this.handleItemPin.bind(this,t,e)}"
					onmouseenter="${this.handleItemPinEnter.bind(this)}"
					onmouseleave="${this.handleItemPinLeave.bind(this)}"
				></span>
			`},getLockedClass:function(t){let e="";if(BX.Type.isDomNode(t)&&this.isLocked(t)){e=this.classItemLocked}return e},getMoreMenuItems:function(){const t=this.getAllItems();const e=this.getHiddenItems();const s=this.getDisabledItems();const i=[];if(t.length){t.forEach((t=>{if(e.indexOf(t)===-1&&s.indexOf(t)===-1){const e=this.getItemData(t);i.push({id:e["DATA_ID"],html:this.getMenuItemText(t),href:e["URL"],onclick:e["ON_CLICK"],title:t.getAttribute("title"),className:[this.classSubmenuItem,this.getIconClass(t),this.classSecret,this.getAliasLink(t),this.getLockedClass(t)].join(" "),items:this.getMoreMenuSubItems(t),events:{onMouseEnter:this.handleMoreMenuItemMouseEnter}})}}))}if(e.length){e.forEach((t=>{const e=this.getItemData(t);const s=[this.classSubmenuItem,this.getIconClass(t),this.getAliasLink(t),this.getLockedClass(t)];if(e["IS_ACTIVE"]===true){s.push(this.classItemActive)}i.push({id:e["DATA_ID"],html:this.getMenuItemText(t),href:e["URL"],onclick:e["ON_CLICK"],title:t.getAttribute("title"),className:s.join(" "),items:this.getMoreMenuSubItems(t),events:{onMouseEnter:this.handleMoreMenuItemMouseEnter}})}))}if(this.isSettingsEnabled){i.push({delimiter:true,html:"<span>"+this.message("MIB_MANAGE")+"</span>",className:[this.classSeparator,this.classSubmenuItem,this.classManage].join(" ")});i.push({html:this.message("MIB_SETTING_MENU_ITEM"),className:[this.classSettingMenuItem,this.classSubmenuItem].join(" ")});const t=["ui-btn",this.theme==="default"?"ui-btn-sm":"ui-btn-xs","ui-btn-success-light","ui-btn-no-caps","ui-btn-round","ui-btn-icon-main-buttons-apply"];i.push({html:`\n\t\t\t\t\t<span class="${t.join(" ")}">\n\t\t\t\t\t\t<span class="ui-btn-text">${this.message("MIB_APPLY_SETTING_MENU_ITEM")}</span>\n\t\t\t\t\t</span>`,className:[this.classSettingsApplyButton,this.classSubmenuItem].join(" ")});i.push({html:this.message("MIB_RESET_SETTINGS"),className:[this.classSettingsResetButton,this.classSubmenuItem].join(" ")});i.push({delimiter:true,html:"<span>"+this.message("MIB_HIDDEN")+"</span>",className:[this.classSeparator,this.classSubmenuItem,this.classHiddenLabel].join(" ")});if(!s.length){i.push({html:"<span>"+this.message("MIB_NO_HIDDEN")+"</span>",className:[this.classSubmenuItem,this.classSubmenuNoHiddenItem].join(" ")})}if(s.length){s.forEach((t=>{const e=this.getItemData(t);const s=[this.classSubmenuItem,this.classItemDisabled,this.getIconClass(t),this.getAliasLink(t),this.getLockedClass(t)];if(e["IS_ACTIVE"]===true){s.push(this.classItemActive)}i.push({id:e["DATA_ID"],html:this.getMenuItemText(t),href:e["URL"],onclick:e["ON_CLICK"],title:t.getAttribute("title"),className:s.join(" "),items:this.getMoreMenuSubItems(t),events:{onMouseEnter:this.handleMoreMenuItemMouseEnter}})}))}}return i},getMenuItems:function(t){return this.createMenuItems(this.getItemData(t),t)},getMoreMenuSubItems:function(t){return this.createMenuItems(this.getItemData(t),null)},createMenuItems:function(t,e=null){if(!BX.Type.isArrayFilled(t["ITEMS"])){return[]}const s=t["ITEMS"];const i=[];for(let t=0;t<s.length;t++){const n=s[t];if(n["IS_PINNED"]||n["IS_DISBANDED"]){continue}const o=n["IS_DELIMITER"]===true;if(o){const t=i.length===0;const e=i[i.length-1];if(t||e&&e["delimiter"]===true){continue}}const a=["menu-popup-no-icon","main-buttons-menu-item"];if(n["IS_ACTIVE"]===true){a.push("main-buttons-menu-item-active")}const u=BX.Text.toBoolean(n["IS_LOCKED"]);if(u){a.push(this.classItemLocked)}if(this.isEditEnabled()){a.push(this.classEditState)}let r;if(o){r={delimiter:true,className:a.join(" "),text:n["TEXT"]}}else{r={html:this.getMenuItemText(n,e),href:n["URL"],onclick:n["ON_CLICK"],title:n["TITLE"],className:a.join(" ")}}const l=n.hasOwnProperty("AJAX_OPTIONS");if(l){r.cacheable=true;r.events=this._getEvents(n["AJAX_OPTIONS"]);r.items=[{id:"loading",text:this.message("MIB_MAIN_BUTTONS_LOADING")}]}else if(BX.Type.isArrayFilled(n["ITEMS"])&&!this.isEditEnabled()){const t=this.createMenuItems(n,e);if(t.length){r.items=t}}i.push(r)}if(i.length&&i[i.length-1]["delimiter"]===true){i.pop()}return i},_setAjaxMode:function(t){for(let e in t){if(!t.hasOwnProperty(e)){continue}if(t[e].hasOwnProperty("ajaxOptions")){t[e].cacheable=true;t[e].events=this._getEvents(t[e]["ajaxOptions"]);t[e].items=[{id:"loading",text:this.message("MIB_MAIN_BUTTONS_LOADING")}]}}},_getEvents:function(t){return{onSubMenuShow:()=>{if(this.subMenuLoaded){return}const e=this.getSubMenu();e.removeMenuItem("loading");const s=e.getMenuItem("loading");this.getSubItems(t).then((t=>{this._setAjaxMode(t);this.subMenuLoaded=true;this.addSubMenu(t);this.showSubMenu()})).catch((t=>{if(s){s.getLayout().text.innerText=t}}))}}},getSubItems:function(t){return new Promise((function(e,s){if(this.progress){s(this.message("MIB_MAIN_BUTTONS_LOADING"));return}if(t.mode==="component"){this.progress=true;BX.ajax.runComponentAction(t.component,t.action,{mode:t.componentMode,signedParameters:t.signedParameters?t.signedParameters:{},data:t.data}).then((t=>{this.progress=false;e(t.data)}))}else{this.progress=true;BX.ajax.runAction(t.action,{data:t.data}).then((t=>{this.progress=false;e(t.data)}))}}))},getMoreMenuArgs:function(){const t=this.getMoreMenuId();const e=this.moreButton;const s=this.getMoreMenuItems();let i;const n=800;if(this.theme==="default"){const t=350;const s=25;i={autoHide:false,compatibleMode:false,offsetLeft:-s,offsetTop:4,cacheable:false,className:"main-buttons-menu-popup main-buttons-more-menu-popup",minWidth:240,maxWidth:t,maxHeight:n,subMenuOptions:{className:"main-buttons-menu-popup main-buttons-more-menu-popup --sub-menu",minWidth:150,maxWidth:t,events:{onFirstShow:this.handleMoreMenuFirstShow.bind(this)}},bindOptions:{position:"bottom",forceTop:true},events:{onClose:this.handleMoreMenuClose.bind(this),onDestroy:this.handleMoreMenuClose.bind(this),onFirstShow:this.handleMoreMenuFirstShow.bind(this),onShow:this.handleMoreMenuShow.bind(this),onBeforeAdjustPosition:this.handleAdjustPosition.bind(this,e)}}}else{const t=this.moreButton.querySelector(".main-buttons-item-text-title");const e=t.offsetWidth;const s=250;const o=e/2-s/2+BX.Main.Popup.getOption("angleLeftOffset");const a=BX.Main.Popup.getOption("angleLeftOffset")-BX.Main.Popup.getOption("angleMinTop");const u=s/2-a;i={autoHide:false,compatibleMode:false,offsetTop:4,offsetLeft:o,minWidth:s,maxWidth:s,maxHeight:n,angle:{position:"top",offset:u},className:"main-buttons-default-menu-popup main-buttons-more-menu-popup",subMenuOptions:{className:"main-buttons-default-menu-popup main-buttons-more-menu-popup --sub-menu",minWidth:null,events:{onFirstShow:this.handleMoreMenuFirstShow.bind(this)}},cacheable:false,bindOptions:{position:"bottom",forceTop:true},events:{onClose:this.handleMoreMenuClose.bind(this),onDestroy:this.handleMoreMenuClose.bind(this),onFirstShow:this.handleMoreMenuFirstShow.bind(this),onShow:this.handleMoreMenuShow.bind(this)}}}if(this.isEditEnabled()){i.className+=" "+this.classEditState}return[t,e,s,i]},getChildMenuArgs:function(t){const e=800;if(this.theme==="default"){const s=25;const i=350;return{autoHide:false,compatibleMode:false,offsetLeft:-s,offsetTop:4,cacheable:false,className:"main-buttons-menu-popup",maxWidth:i,minWidth:t.offsetWidth+s*2+30,maxHeight:e,subMenuOptions:{className:"main-buttons-menu-popup --sub-menu",minWidth:null,events:{onFirstShow:this._onChildMenuFirstShow.bind(this)}},bindOptions:{position:"bottom",forceTop:true},events:{onFirstShow:this._onChildMenuFirstShow.bind(this),onShow:this._onChildMenuShow.bind(this,t),onClose:this._onChildMenuClose.bind(this,t),onDestroy:this._onChildMenuClose.bind(this,t),onBeforeAdjustPosition:this.handleAdjustPosition.bind(this,t)}}}else{const s=250;return{autoHide:false,compatibleMode:false,offsetTop:4,cacheable:false,className:"main-buttons-default-menu-popup",minWidth:Math.min(t.offsetWidth+25*2+30,s),maxWidth:s,maxHeight:e,bindOptions:{position:"bottom",forceTop:true},subMenuOptions:{className:"main-buttons-default-menu-popup --sub-menu",minWidth:null,events:{onFirstShow:this._onChildMenuFirstShow.bind(this)}},events:{onFirstShow:this._onChildMenuFirstShow.bind(this),onShow:this._onChildMenuShow.bind(this,t),onClose:this._onChildMenuClose.bind(this,t),onDestroy:this._onChildMenuClose.bind(this,t)}}}},centerPopupArrow(t,e){const s=e.offsetWidth;const i=t.getPopupContainer().offsetWidth;const n=s/2-i/2;const o=BX.Main.Popup.getOption("angleLeftOffset")-BX.Main.Popup.getOption("angleMinTop");t.setAngle({offset:i/2-o});t.setOffset({offsetLeft:n+BX.Main.Popup.getOption("angleLeftOffset")})},visibleControlMoreButton:function(){const t=this.getHiddenItems();if(!t.length){this.getMoreButton().style.display="none"}else{this.getMoreButton().style.display=""}},createMoreMenu:function(){const t=BX.Main.MenuManager.create(...this.getMoreMenuArgs());if(this.isSettingsEnabled){this.dragAndDropInitInSubmenu()}t.getMenuItems().forEach((function(t){const e=t.getLayout().item;BX.Event.bind(e,"click",BX.delegate(this._onDocumentClick,this))}),this);return t},createChildMenu:function(t){const e=this.getMenuItems(t);if(e.length){const s=BX.Main.MenuManager.create(this.getChildMenuId(),t,e,this.getChildMenuArgs(t));if(!this.isEditEnabled()&&this.isSettingsEnabled){const e=()=>{this.showMoreMenu();this.enableEdit();this.destroyChildMenu();this.showChildMenu(t)};s.getMenuItems().forEach((t=>{const s=t.getLayout().item;s.draggable=true;BX.Event.bind(s,"dragstart",e)}))}return s}return null},showMoreMenu:function(){clearTimeout(this.submenuLeaveTimeout);if(!this.isEditEnabled()){this.closeChildMenu()}let t=this.getMoreMenu();if(t!==null){t.getPopupWindow().show()}else{this.destroyMoreMenu();t=this.createMoreMenu();t.getPopupWindow().show()}this.setMoreMenuShown(true);this.activateItem(this.moreButton);if(this.isEditEnabled()){t.getPopupWindow().setAutoHide(false)}},showChildMenu:function(t){clearTimeout(this.childMenuLeaveTimeout);if(!this.isEditEnabled()){this.closeMoreMenu()}if(!this.isVisibleItem(t)){return}const e=BX.Main.MenuManager.getMenuById(this.getChildMenuId());if(e&&e.bindElement===t){e.getPopupWindow().show();this.destroyItemEditMenu()}else{this.destroyChildMenu(t);const e=this.createChildMenu(t);if(e){e.getPopupWindow().show();this.destroyItemEditMenu()}}},closeMoreMenu:function(){const t=this.getMoreMenu();if(t===null){return}t.getPopupWindow().close();if(!this.isActiveInMoreMenu()){this.deactivateItem(this.moreButton)}this.setMoreMenuShown(false)},closeChildMenu:function(){const t=this.getChildMenu();if(t===null){return}this.closePinHint();t.close()},getMoreMenu:function(){return BX.Main.MenuManager.getMenuById(this.getMoreMenuId())},getChildMenu:function(){return BX.Main.MenuManager.getMenuById(this.getChildMenuId())},destroyMoreMenu:function(){BX.Main.MenuManager.destroy(this.getMoreMenuId())},destroyChildMenu:function(){BX.Main.MenuManager.destroy(this.getChildMenuId())},refreshMoreMenu:function(){const t=this.getMoreMenu();if(t===null){return}const e=this.getMoreMenuArgs();if(BX.Type.isArray(e)){this.destroyMoreMenu();this.createMoreMenu();this.showMoreMenu()}},setMoreMenuShown:function(t){this.isSubmenuShown=false;if(BX.type.isBoolean(t)){this.isSubmenuShown=t}if(this.isSubmenuShown){BX.Dom.addClass(this.moreButton,this.classMenuShown)}else{BX.Dom.removeClass(this.moreButton,this.classMenuShown)}},activateItem:function(t){if(!BX.Type.isDomNode(t)){return}if(!BX.Dom.hasClass(t,this.classItemActive)){BX.Dom.addClass(t,this.classItemActive)}},deactivateItem:function(t){if(!BX.Type.isDomNode(t)){return}if(BX.Dom.hasClass(t,this.classItemActive)){BX.Dom.removeClass(t,this.classItemActive)}},getCurrentSettings:function(){const t={};this.getAllItems().forEach(((e,s)=>{t[e.id]={sort:s,isDisabled:this.isDisabled(e),isPinned:this.isPinned(e)}}));return t},initSaving:function(t){this.sendOptions=this.sendOptions.bind(this);this.optionsToSave=[];this.debouncedSendOptions=BX.debounce(this.sendOptions,5e3);if(BX.Type.isPlainObject(t)){this.ajaxSettings={componentName:t.componentName,signedParams:t.signedParams}}},sendOptions:function(){if(this.optionsToSave.length<=0){return}const t={};this.optionsToSave.forEach((function(e){t[e.name]=e.value}));this.optionsToSave=[];window.removeEventListener("beforeunload",this.sendOptions);BX.removeCustomEvent("SidePanel.Slider:onClose",this.sendOptions);return BX.ajax.runComponentAction(this.ajaxSettings.componentName,"save",{mode:"class",signedParameters:this.ajaxSettings.signedParams,data:{options:t}})},saveOptions:function(t,e){if(this.ajaxSettings){if(this.optionsToSave.length<=0){window.addEventListener("beforeunload",this.sendOptions);BX.addCustomEvent("SidePanel.Slider:onClose",this.sendOptions)}this.optionsToSave.push({name:t,value:e});this.debouncedSendOptions()}else if(this.listContainer.id){BX.userOptions.save("ui",this.listContainer.id,t,e)}},saveSettings:function(){const t=this.getCurrentSettings();const e="settings";if(!BX.Type.isPlainObject(t)){return}if(BX.Type.isDomNode(this.listContainer)){if("id"in this.listContainer){this.saveOptions(e,JSON.stringify(t));this.setHome()}}},resetSettings:function(){let t=null;const e=BX.PopupWindowManager.create(this.listContainer.id+"_reset_popup",null,{content:this.message("MIB_RESET_ALERT"),autoHide:false,overlay:true,closeByEsc:true,closeIcon:true,draggable:{restrict:true},titleBar:this.message("MIB_RESET_SETTINGS"),buttons:[t=new BX.PopupWindowButton({text:this.message("MIB_RESET_BUTTON"),className:"popup-window-button-create",events:{click:()=>{if(BX.Dom.hasClass(t.buttonNode,"popup-window-button-wait")){return}BX.Dom.addClass(t.buttonNode,"popup-window-button-wait");this.handleResetSettings((s=>{if(s){BX.Dom.removeClass(t.buttonNode,"popup-window-button-wait");e.setContent(s)}else{this.saveOptions("settings",JSON.stringify({}));this.saveOptions("firstPageLink","");this.sendOptions().then((function(){window.location.reload()})).catch((function(){window.location.reload()}))}}))}}}),new BX.PopupWindowButtonLink({text:this.message("MIB_CANCEL_BUTTON"),className:"popup-window-button-link-cancel",events:{click:function(){this.popupWindow.close()}}})]});e.show()},handleResetSettings:function(t){const e=[];BX.onCustomEvent("BX.Main.InterfaceButtons:onBeforeResetMenu",[e,this]);let s=new BX.Promise;const i=s;for(let t=0;t<e.length;t++){s=s.then(e[t])}s.then((function(e){t(null,e)}),(function(e){t(e,null)}));i.fulfill()},moveButtonAlias:function(t,e){if(!t||!this.dragItem){return}const s=this.getItemAlias(this.dragItem);const i=this.getItemAlias(t);if(this.isListItem(s)){if(i){if(e){BX.Dom.insertAfter(s,i)}else{this.listContainer.insertBefore(s,i)}}else{this.listContainer.appendChild(s)}}if(this.getMoreMenu()){this.getMoreMenu().getPopupWindow().adjustPosition()}},moveButton:function(t,e){if(!BX.Type.isDomNode(t)||!BX.Type.isDomNode(this.dragItem)){return}if(this.isListItem(t)){if(this.isDisabled(this.dragItem)){this.dragItem.dataset.disabled="false"}if(BX.Type.isDomNode(t)){if(e){BX.Dom.insertAfter(this.dragItem,t)}else{this.listContainer.insertBefore(this.dragItem,t)}}else{this.listContainer.appendChild(this.dragItem)}}if(this.isSubmenuItem(t)){if(e){BX.Dom.insertAfter(this.dragItem,t)}else{this.getMoreMenuContainer().insertBefore(this.dragItem,t)}}},getMoreMenuContainer:function(){const t=this.getMoreMenu();let e=null;if(t!==null){e=t.itemsContainer}return e},findNextSiblingByClass:function(t,e){const s=t;for(;!!t;t=t.nextElementSibling){if(e){if(BX.Dom.hasClass(t,e)&&t!==s){return t}}else{return null}}return null},findChildrenByClassName:function(t,e){let s=null;if(BX.Type.isDomNode(t)&&BX.Type.isStringFilled(e)){s=BX.Buttons.Utils.getByClass(t,e)}return s},initItems:function(){this.getAllItems().forEach((t=>{this.initItem(t)}))},initItem:function(t){if(this.isSettingsEnabled){t.setAttribute("draggable","true");t.setAttribute("tabindex","-1");BX.Event.bind(t,"dragstart",BX.delegate(this._onDragStart,this));BX.Event.bind(t,"dragend",BX.delegate(this._onDragEnd,this));BX.Event.bind(t,"dragenter",BX.delegate(this._onDragEnter,this));BX.Event.bind(t,"dragover",BX.delegate(this._onDragOver,this));BX.Event.bind(t,"dragleave",BX.delegate(this._onDragLeave,this));BX.Event.bind(t,"drop",BX.delegate(this._onDrop,this));t.dataset.link="item-"+BX.Text.getRandom().toLowerCase()}BX.Event.bind(t,"click",this._handleItemClick.bind(this));BX.Event.bind(t,"mouseenter",this.handleItemMouseEnter.bind(this));BX.Event.bind(t,"mouseleave",this.handleItemMouseLeave.bind(this))},dragAndDropInitInSubmenu:function(){const t=this.getMoreMenu();if(!t){return}const e=t.menuItems;e.forEach((t=>{if(this.isSeparator(t.layout.item)||this.isSettings(t.layout.item)||this.isApplySettingsButton(t.layout.item)||this.isResetSettingsButton(t.layout.item)){t.layout.item.draggable=false}else{t.layout.item.draggable=true;t.layout.item.dataset.sortable=true;BX.Event.bind(t.layout.item,"dragstart",BX.delegate(this._onDragStart,this));BX.Event.bind(t.layout.item,"dragenter",BX.delegate(this._onDragEnter,this));BX.Event.bind(t.layout.item,"dragover",BX.delegate(this._onDragOver,this));BX.Event.bind(t.layout.item,"dragleave",BX.delegate(this._onDragLeave,this));BX.Event.bind(t.layout.item,"dragend",BX.delegate(this._onDragEnd,this));BX.Event.bind(t.layout.item,"drop",BX.delegate(this._onDrop,this))}if(BX.Dom.hasClass(t.layout.item,this.classHiddenLabel)||BX.Dom.hasClass(t.layout.item,this.classManage)){BX.Event.bind(t.layout.item,"dragover",BX.delegate(this._onDragOver,this))}}))},getItem:function(t){if(!BX.Type.isDomNode(t)){if(!t||!BX.Type.isDomNode(t.target)){return null}}else{t={target:t}}let e=t.target.closest("."+this.classItem);if(!BX.Type.isDomNode(e)){e=t.target.closest("."+this.classDefaultSubmenuItem+", ."+this.classDefaultSubmenuDelimimeter)}return e},getItemData:function(t){if(!BX.Type.isDomNode(t)){return{}}const e=this.itemData.get(t);if(e){return e}let s;try{s=JSON.parse(t.dataset.item)}catch(t){s={}}this.setItemData(t,s);return s},setItemData(t,e){if(BX.Type.isElementNode(t)&&BX.Type.isPlainObject(e)){e.NODE=t;this.itemData.set(t,e)}},setOpacity:function(t){if(!BX.Type.isDomNode(t)){return}BX.style(t,"opacity",.5)},unsetOpacity:function(t){if(!BX.Type.isDomNode(t)){return}BX.style(t,"opacity","1")},setDragStyles:function(){BX.Dom.addClass(this.listContainer,this.classOnDrag);BX.Dom.addClass(BX(this.getMoreMenuId(true)),this.classOnDrag);this.setOpacity(this.dragItem)},unsetDragStyles:function(){const t=this.getMoreMenu();this.getAllItems().forEach((t=>{this.unsetOpacity(t);BX.Dom.removeClass(t,this.classItemOver)}));if(t&&BX.Type.isArray(t.menuItems)&&t.menuItems.length){t.menuItems.forEach((t=>{this.unsetOpacity(t);BX.Dom.removeClass(t.layout.item,this.classItemOver)}))}BX.Dom.removeClass(this.listContainer,this.classOnDrag);BX.Dom.removeClass(BX(this.getMoreMenuId(true)),this.classOnDrag)},getIconClass:function(t){let e="";if(BX.Type.isDomNode(t)&&"dataset"in t&&"class"in t.dataset&&BX.Type.isStringFilled(t.dataset.class)){e=t.dataset.class}return e},disableItem:function(t){const e=this.getItemAlias(t);if(t&&"dataset"in t){t.dataset.disabled="true";if(e){e.dataset.disabled="true"}}},enableItem:function(t){let e;if(!BX.Type.isDomNode(t)){return}if(this.isSubmenuItem(t)){BX.Dom.removeClass(t,this.classItemDisabled);e=this.getItemAlias(t);if(BX.Type.isDomNode(e)){e.dataset.disabled="false"}}},getAliasLink:function(t){return this.dataValue(t,"link")||""},getItemAlias:function(t){let e=null;if(!BX.Type.isDomNode(t)){return e}const s=this.getAllItems();const i=this.isSubmenuItem(t);const n=this.isListItem(t);if(!i&&!n){return e}if(i){s.forEach((function(s){BX.Dom.hasClass(t,this.getAliasLink(s))&&(e=s)}),this)}if(n){e=BX.Buttons.Utils.getByClass(document,this.getAliasLink(t))}return e},hideItem:function(t){!!t&&BX.Dom.addClass(t,this.classSecret)},showItem:function(t){!!t&&BX.Dom.removeClass(t,this.classSecret)},fakeDragItem:function(){if(!BX.Type.isDomNode(this.dragItem)||!BX.Type.isDomNode(this.overItem)){return}let t=null;if(this.isDragToSubmenu()){t=this.getItemAlias(this.dragItem);if(t!==this.dragItem){this.listContainer.appendChild(this.dragItem);this.dragItem=t;this.showItem(this.dragItem);this.adjustMoreButtonPosition();this.updateMoreMenuItems();this.tmp.moved=false;this.tmp.movetToSubmenu=true;this.setOpacity(this.dragItem)}}if(this.isDragToList()&&!this.tmp.movetToSubmenu){t=this.getItemAlias(this.dragItem);if(t!==this.dragItem){this.hideItem(this.dragItem);this.dragItem=t;this.adjustMoreButtonPosition();this.updateMoreMenuItems();this.setOpacity(this.dragItem)}}this.tmp.movetToSubmenu=false},updateMoreMenuItems:function(){const t=this.getMoreMenu();if(t===null){return}const e=t.menuItems;if(!BX.Type.isArray(e)||!e.length){return}const s=this.getHiddenItems();const i=this.getDisabledItems();const n=i.concat(s);e.forEach((t=>{const e=[].some.call(n,(e=>BX.Dom.hasClass(t.layout.item,this.dataValue(e,"link"))||this.isDisabled(t.layout.item)||this.isSeparator(t.layout.item)||this.isDropzone(t.layout.item)));if(e||(this.isSettings(t.layout.item)||this.isApplySettingsButton(t.layout.item)||this.isResetSettingsButton(t.layout.item)||this.isNotHiddenItem(t.layout.item)||this.isSeparator(t.layout.item)||t.layout.item===this.dragItem)&&!this.isMoreButton(t.layout.item)){this.showItem(t.layout.item)}else{this.hideItem(t.layout.item)}}))},isNotHiddenItem:function(t){return BX.Dom.hasClass(t,this.classSubmenuNoHiddenItem)},getNotHidden:function(){return BX.Buttons.Utils.getByClass(this.getMoreMenuContainer(),this.classSubmenuNoHiddenItem)},setOverStyles:function(t){if(BX.Type.isDomNode(t)&&!BX.Dom.hasClass(t,this.classItemOver)){BX.Dom.addClass(t,this.classItemOver)}},unsetOverStyles:function(t){if(BX.Type.isDomNode(t)&&BX.Dom.hasClass(t,this.classItemOver)){BX.Dom.removeClass(t,this.classItemOver)}},dataValue:function(t,e){let s="";if(BX.Type.isDomNode(t)){const i=BX.data(t,e);if(typeof i!=="undefined"){s=i}}return s},execScript:function(t,e){if(BX.Type.isStringFilled(t)){const s=new Function("event",t);s(e)}},showLicenseWindow:function(){if(!B24.licenseInfoPopup){return}const t=B24.licenseInfoPopup;t.init({B24_LICENSE_BUTTON_TEXT:this.message("MIB_LICENSE_BUY_BUTTON"),B24_TRIAL_BUTTON_TEXT:this.message("MIB_LICENSE_TRIAL_BUTTON"),IS_FULL_DEMO_EXISTS:this.licenseParams.isFullDemoExists,HOST_NAME:this.licenseParams.hostname,AJAX_URL:this.licenseParams.ajaxUrl,LICENSE_ALL_PATH:this.licenseParams.licenseAllPath,LICENSE_DEMO_PATH:this.licenseParams.licenseDemoPath,FEATURE_GROUP_NAME:this.licenseParams.featureGroupName,AJAX_ACTIONS_URL:this.licenseParams.ajaxActionsUrl,B24_FEATURE_TRIAL_SUCCESS_TEXT:this.message("MIB_LICENSE_WINDOW_TRIAL_SUCCESS_TEXT")});t.show("main-buttons",this.message("MIB_LICENSE_WINDOW_HEADER_TEXT"),this.message("MIB_LICENSE_WINDOW_TEXT"))},_handleItemClick:function(t){if(!this.isEditEnabled()){const e=this.getItem(t);this.showChildMenu(e)}},handleEditButtonClick:function(t){t.preventDefault();t.stopPropagation();let e=this.getItem(t);if(!BX.Type.isDomNode(e)){return}if(this.isSubmenuItem(e)){e=this.getItemAlias(e)}const s=this.getItemData(e);const i=this.getItemEditMenu();if(i&&i.popupWindow.isShown()&&this.lastEditNode===e){i.popupWindow.close()}else{this.showItemEditMenu(s,t.target)}this.lastEditNode=e},handleDragButtonClick:function(t){t.preventDefault();t.stopPropagation()},handleItemPinEnter:function(t){const e=this.getChildMenu();if(e){this.showPinHint(t.currentTarget)}},showPinHint:function(t){const e=48;const s=BX.Main.PopupManager.create({id:"main-buttons-pin-hint",closeByEsc:true,padding:15,className:"main-buttons-pin-hint-popup",height:e,cacheable:false,autoHide:true,bindOptions:{forceBindPosition:true},content:this.message("MIB_PIN_HINT"),darkMode:true,events:{onAfterShow:function(e){const s=e.getTarget();const i=BX.Dom.getPosition(t);const n=BX.Dom.getPosition(s.getPopupContainer());if(n.left<i.left+i.width){s.setAngle({position:"top",offset:0});s.setOffset({offsetLeft:20,offsetTop:5});s.adjustPosition()}}}});s.setAngle({position:"left",offset:0});s.setOffset({offsetLeft:t.offsetWidth+5,offsetTop:-t.offsetHeight/2-e/2-2});s.setBindElement(t);s.show();s.adjustPosition()},closePinHint:function(){const t=BX.Main.PopupManager.getPopupById("main-buttons-pin-hint");if(t){t.close()}},handleItemPinLeave:function(t){this.closePinHint()},handleItemPin:function(t,e,s){s.stopPropagation();s.preventDefault();const i=this.createRootItem(t);BX.Dom.addClass(i,"main-buttons-item-insert-animation");BX.Dom.insertBefore(i,e);requestAnimationFrame((()=>{requestAnimationFrame((()=>{BX.Dom.style(i,{width:i.scrollWidth+"px",opacity:1})}))}));const n=()=>{BX.Dom.removeClass(i,"main-buttons-item-insert-animation");BX.Dom.style(i,"width",null);BX.Dom.style(i,"opacity",null);const t=this.getItemData(e);this.recalculateItemsCounters([t]);this.showMoreMenu();this.updateMoreButtonCounter();this.showChildMenu(e);this.saveSettings()};setTimeout(n,300);this.initItem(i);this.pinItem(t);this.destroyMoreMenu();this.destroyChildMenu()},handleItemUnpin:function(t,e){BX.Dom.style(e,{width:e.offsetWidth+"px"});BX.Dom.addClass(e,"main-buttons-item-insert-animation");requestAnimationFrame((()=>{requestAnimationFrame((()=>{BX.Dom.style(e,{width:0,margin:0,opacity:0})}))}));const s=()=>{BX.Dom.remove(e);this.showMoreMenu();this.updateMoreButtonCounter();this.saveSettings()};setTimeout(s,300);this.pinItem(t,false);const i=[];let n="";const o=t["ID"].split(":");o.forEach((t=>{n+=`${n===""?"":":"}${t}`;const e=this.getItemById(n);if(e){i.push(this.getItemData(e))}}));this.destroyMoreMenu();this.recalculateItemsCounters(i)},pinItem:function(t,e=true){const s=t["ID"];const i=s.split(":");let n="";i.forEach(((t,o)=>{n+=`${n===""?"":":"}${t}`;const a=this.getItemById(n);if(!a){return}const u=this.getItemData(a);let r=u["ITEMS"];let l=n;const h=i.slice(o+1);const m=[u];while(BX.Type.isArrayFilled(h)&&BX.Type.isArrayFilled(r)){l=l+":"+h.shift();for(let t=0;t<r.length;t++){const i=r[t];if(i["ID"]===s){i["IS_PINNED"]=e;for(let t=m.length-1;t>=0;t--){const s=m[t];const i=t===0;if(e){const t=s["ITEMS"].some((t=>{const e=t["IS_PINNED"]===true;const s=t["IS_DISBANDED"]===true;const i=t["IS_DELIMITER"]===true;return!e&&!s&&!i}));if(!t){s["IS_DISBANDED"]=true;if(i){a.dataset.disbanded=true}}}else{if(i){a.dataset.disbanded=false}s["IS_DISBANDED"]=false}const n=s["ITEMS"].some((t=>t["IS_ACTIVE"]===true&&t["IS_PINNED"]!==true&&t["IS_DELIMITER"]!==true));if(n){s["IS_ACTIVE"]=true;if(i){this.activateItem(a)}}else{s["IS_ACTIVE"]=false;if(i){this.deactivateItem(a)}}}return}else if(i["ID"]===l){r=i["ITEMS"];l=i["ID"];m.push(i);break}}}}))},getParentItem:function(t){const e=t.split(":");let s="";for(let i=0;i<e.length;i++){s+=`${s===""?"":":"}${e[i]}`;const n=this.getItemById(s);if(!n){continue}const o=this.getItemData(n);let a=o["ITEMS"];let u=s;const r=e.slice(i+1);let l=null;while(BX.Type.isArrayFilled(r)&&BX.Type.isArrayFilled(a)){u=u+":"+r.shift();for(let e=0;e<a.length;e++){const s=a[e];if(s["ID"]===t){return l===null?o:l}else if(s["ID"]===u){a=s["ITEMS"];u=s["ID"];l=s;break}}}}return null},_onDragStart:function(t){const e=this.getVisibleItems();const s=BX.Type.isArray(e)?e.length:null;this.dragItem=this.getItem(t);if(!BX.Type.isDomNode(this.dragItem)){return}if(s===1&&this.isListItem(this.dragItem)){t.preventDefault();BX.onCustomEvent(window,"BX.Main.InterfaceButtons:onHideLastVisibleItem",[this.dragItem,this]);return}if(this.isMoreButton(this.dragItem)||this.isSeparator(this.dragItem)||this.isNotHiddenItem(this.dragItem)||BX.Dom.attr(this.dragItem,"data-parent-item-id")||BX.Dom.attr(this.dragItem,"data-has-child")){t.preventDefault();return}this.onDragStarted=true;this.closeChildMenu();this.destroyItemEditMenu();if(this.isListItem(this.dragItem)){this.showMoreMenu()}this.setDragStyles();if(!this.isEditEnabled()){this.enableEdit()}},_onDragEnd:function(t){t.preventDefault();const e=this.getItem(t);this.onDragStarted=false;if(!BX.Type.isDomNode(e)){return}this.unsetDragStyles();this.refreshMoreMenu();if(!this.isEditEnabled()){this.closeMoreMenu()}const s=BX.findNextSibling(this.dragItem,(t=>this.isVisibleItem(t)));const i=BX.findPreviousSibling(this.dragItem,(t=>this.isVisibleItem(t)));if(BX.Dom.hasClass(i,this.classHiddenLabel)||this.isDisabled(i)&&this.isSubmenuItem(i)||this.isDisabled(s)&&this.isSubmenuItem(s)){this.disableItem(this.dragItem);this.refreshMoreMenu()}if(this.isEditEnabled()){this.enableEdit()}else{this.disableEdit()}this.updateMoreButtonCounter();this.saveSettings();this.dragItem=null;this.overItem=null;this.tmp.moved=false},updateMoreButtonCounter:function(){let t=this.getHiddenItems();const e=this.getDisabledItems();t=t.concat(e);let s=0;if(BX.Type.isArray(t)){t.forEach((t=>{const e=this.getItemData(t);const i=BX.Type.isNumber(e["COUNTER"])&&e["COUNTER"]>0?e["COUNTER"]:0;s+=i}))}if(BX.Type.isNumber(s)){this.setMoreButtonCounter(s)}},_onDragEnter:function(t){const e=this.getItem(t);if(BX.Type.isDomNode(e)&&this.isNotHiddenItem(e)){this.setOverStyles(e)}},_onDragOver:function(t){t.preventDefault();this.overItem=this.getItem(t);if(!BX.Type.isDomNode(this.overItem)||!BX.Type.isDomNode(this.dragItem)||this.overItem===this.dragItem||this.isNotHiddenItem(this.overItem)||BX.Dom.attr(this.overItem,"data-parent-item-id")||BX.Dom.attr(this.overItem,"data-has-child")){return}this.fakeDragItem();const e=this.isNext(t);const s=this.isGoodPosition(t);if(e&&s){let t;let e=false;if(this.isListItem(this.overItem)){t=this.findNextSiblingByClass(this.overItem,this.classItem);if(t===null&&this.getLastVisibleItem()===this.overItem){t=this.overItem;e=true}}else{t=this.findNextSiblingByClass(this.overItem,this.classSubmenuItem);if(this.isSettings(t)||this.isApplySettingsButton(t)||this.isResetSettingsButton(t)){return}if(t===null&&this.getItemAlias(this.getLastDisabledItem())===this.overItem){t=this.overItem;e=true}}if(BX.Type.isDomNode(t)){this.moveButton(t,e);this.moveButtonAlias(t,e);this.adjustMoreButtonPosition();this.updateMoreMenuItems()}}else if(!e&&s&&!BX.Dom.hasClass(this.overItem,this.classHiddenLabel)){this.moveButton(this.overItem);this.moveButtonAlias(this.overItem);this.adjustMoreButtonPosition();this.updateMoreMenuItems()}},_onDragLeave:function(t){const e=this.getItem(t);if(BX.Type.isDomNode(e)){this.unsetOverStyles(t.target)}},_onDrop:function(t){const e=this.getItem(t);if(!BX.Type.isDomNode(e)){return}if(this.isNotHiddenItem(e)||this.isDisabled(e)){this.disableItem(this.dragItem);this.adjustMoreButtonPosition()}const s=this.getItemAlias(this.dragItem);if(this.isListItem(s)){s.dataset.disabled="false"}this.unsetDragStyles();t.preventDefault()},handleMoreMenuFirstShow:function(t){const e=t.getTarget();BX.Event.bind(e.getPopupContainer(),"mouseenter",this.handleMoreMenuMouseEnter.bind(this));BX.Event.bind(e.getPopupContainer(),"mouseleave",this.handleMoreMenuMouseLeave.bind(this))},handleMoreMenuMouseEnter:function(){clearTimeout(this.submenuLeaveTimeout)},handleMoreMenuMouseLeave:function(){this.tryCloseMoreMenuOnTimeout()},tryCloseMoreMenuOnTimeout:function(){clearTimeout(this.submenuLeaveTimeout);if(!this.isEditEnabled()){this.submenuLeaveTimeout=setTimeout((()=>{this.closeMoreMenu()}),500)}},handleMoreMenuShow:function(t){BX.Event.EventEmitter.emit("BX.Main.InterfaceButtons:onMenuShow");BX.Event.EventEmitter.emit(this,"BX.Main.InterfaceButtons:onMoreMenuShow",{event:t});setTimeout((()=>{if(!this.isEditEnabled()){t.getTarget().setAutoHide(true)}}),500)},handleMoreMenuClose:function(){BX.Event.EventEmitter.emit(this,"BX.Main.InterfaceButtons:onMoreMenuClose");this.setMoreMenuShown(false);if(this.isEditEnabled()){this.activateItem(this.moreButton)}else{if(!this.isActiveInMoreMenu()){this.deactivateItem(this.moreButton)}}this.destroyItemEditMenu()},_onChildMenuFirstShow:function(t){const e=t.getTarget();BX.Event.bind(e.getPopupContainer(),"mouseenter",this._onChildMenuMouseEnter.bind(this));BX.Event.bind(e.getPopupContainer(),"mouseleave",this._onChildMenuMouseLeave.bind(this))},_onChildMenuMouseEnter:function(){clearTimeout(this.childMenuLeaveTimeout)},_onChildMenuMouseLeave:function(){this.tryCloseChildMenuOnTimeout()},tryCloseChildMenuOnTimeout:function(){if(this.isEditEnabled()){return}clearTimeout(this.childMenuLeaveTimeout);this.childMenuLeaveTimeout=setTimeout((()=>{this.closeChildMenu()}),500)},_onChildMenuShow:function(t,e){BX.Dom.addClass(t,this.classMenuShown);BX.Event.EventEmitter.emit("BX.Main.InterfaceButtons:onMenuShow");BX.Event.EventEmitter.emit(this,"BX.Main.InterfaceButtons:onSubMenuShow",{item:t,event:e});if(this.theme!=="default"){this.centerPopupArrow(e.getTarget(),t)}setTimeout((()=>{e.getTarget().setAutoHide(true)}),500)},_onChildMenuClose:function(t){BX.Event.EventEmitter.emit(this,"BX.Main.InterfaceButtons:onSubMenuClose");BX.Dom.removeClass(t,this.classMenuShown);this.closePinHint()},handleAdjustPosition:function(t,e){const s=25;const i=BX.Dom.getPosition(t);const n=e.getTarget();if(e.left<i.left-s){const t=n.getPopupContainer().offsetWidth;const o=i.right-t+s;if(o>0){e.left=o;BX.Dom.addClass(n.getPopupContainer(),"--left-handed")}}else{BX.Dom.removeClass(n.getPopupContainer(),"--left-handed")}},_onResizeHandler:function(){this.adjustMoreButtonPosition();this.updateMoreMenuItems();this.closeChildMenu();if(!this.isSettingsEnabled){this.visibleControlMoreButton()}},handleMoreButtonClick:function(t){t.preventDefault();this.showMoreMenu()},handleMoreButtonMouseEnter:function(t){if(this.enableItemMouseEnter){clearTimeout(this.menuShowTimeout);this.menuShowTimeout=setTimeout((()=>{this.showMoreMenu()}),100)}clearTimeout(this.submenuLeaveTimeout)},handleMoreButtonMouseLeave:function(){clearTimeout(this.menuShowTimeout);this.tryCloseMoreMenuOnTimeout()},handleItemMouseEnter:function(t){if(!this.enableItemMouseEnter){return}if(this.onDragStarted){return}const e=this.getItem(t);clearTimeout(this.childMenuLeaveTimeout);clearTimeout(this.menuShowTimeout);this.menuShowTimeout=setTimeout((()=>{this.showChildMenu(e)}),100);BX.Dom.addClass(e,this.classItemOver)},handleItemMouseLeave:function(t){clearTimeout(this.menuShowTimeout);if(!this.enableItemMouseEnter){return}if(this.onDragStarted){return}const e=this.getItem(t);BX.Dom.removeClass(e,this.classItemOver);this.tryCloseChildMenuOnTimeout()},handleMoreMenuItemMouseEnter:function(t){if(this.isEditEnabled()){t.preventDefault()}},getSettingsResetButton:function(){return BX.Buttons.Utils.getByClass(this.getMoreMenuContainer(),this.classSettingsResetButton)},isDisabled:function(t){let e=false;if(BX.Type.isDomNode(t)){e=this.dataValue(t,"disabled")==="true"||BX.Dom.hasClass(t,this.classItemDisabled)}return e},isPinned:function(t){let e=false;if(BX.Type.isDomNode(t)){e=this.getItemData(t)["IS_PINNED"]===true}return e},isSettings:function(t){let e=false;if(BX.Type.isDomNode(t)){e=BX.Dom.hasClass(t,this.classSettingMenuItem)}return e},isLocked:function(t){let e=false;if(BX.Type.isDomNode(t)){e=this.dataValue(t,"locked")==="true"||BX.Dom.hasClass(t,this.classItemLocked)}return e},isDropzone:function(t){return BX.Dom.hasClass(t,this.classDropzone)},isNext:function(t){const e=this.dragItem.getBoundingClientRect();const s=this.overItem.getBoundingClientRect();const i=getComputedStyle(this.dragItem);const n=parseInt(i.marginRight.replace("px",""));let o=null;if(this.isListItem(this.overItem)){o=t.clientX>s.left-n&&t.clientX>e.right}if(this.isSubmenuItem(this.overItem)){o=t.clientY>e.top}return o},isGoodPosition:function(t){const e=this.overItem;if(!BX.Type.isDomNode(e)){return false}let s;const i=e.getBoundingClientRect();if(this.isListItem(e)){s=this.isNext(t)&&t.clientX>=i.left+i.width/2||!this.isNext(t)&&t.clientX<=i.left+i.width/2}if(this.isSubmenuItem(e)){s=this.isNext(t)&&t.clientY>=i.top+i.height/2||!this.isNext(t)&&t.clientY<=i.top+i.height/2}return s},isSubmenuItem:function(t){return BX.Dom.hasClass(t,this.classSubmenuItem)},isVisibleItem:function(t){if(!BX.Type.isDomNode(t)){return false}return t.offsetTop===0},isMoreButton:function(t){let e=false;if(BX.Type.isDomNode(t)&&BX.Dom.hasClass(t,this.classItemMore)){e=true}return e},isListItem:function(t){let e=false;if(BX.Type.isDomNode(t)&&BX.Dom.hasClass(t,this.classItem)){e=true}return e},isSublink:function(t){let e=false;if(BX.Type.isDomNode(t)){e=BX.Dom.hasClass(t,this.classItemSublink)}return e},isSeparator:function(t){let e=false;if(BX.Type.isDomNode(t)){e=BX.Dom.hasClass(t,this.classSeparator)}return e},isDragToSubmenu:function(){return!this.isSubmenuItem(this.dragItem)&&this.isSubmenuItem(this.overItem)},isDragToList:function(){return this.isSubmenuItem(this.dragItem)&&!this.isSubmenuItem(this.overItem)}}}if(typeof BX.Main.interfaceButtonsManager==="undefined"){BX.Main.interfaceButtonsManager={data:{},init:function(t){let e=null;if(!BX.Type.isPlainObject(t)||!("containerId"in t)){throw"BX.Main.interfaceButtonsManager: containerId not set in params Object"}e=BX(t.containerId);if(BX.Type.isDomNode(e)){this.data[t.containerId]=new BX.Main.interfaceButtons(e,t)}else{BX(BX.delegate((function(){e=BX(t.containerId);if(!BX.Type.isDomNode(e)){throw"BX.Main.interfaceButtonsManager: container is not dom node"}this.data[t.containerId]=new BX.Main.interfaceButtons(e,t)}),this))}},getById:function(t){let e=null;if(BX.type.isString(t)&&BX.Type.isStringFilled(t)){try{e=this.data[t]}catch(t){}}return e},getObjects:function(){return this.data}}}
//# sourceMappingURL=script.map.js